package com.ssy.lingxi.system.controller;

import com.ssy.lingxi.common.response.Wrapper;
import com.ssy.lingxi.system.dto.request.RuleConfigurationRequest;
import com.ssy.lingxi.system.dto.response.RuleConfigurationListResponse;
import com.ssy.lingxi.system.model.response.RuleVO;
import com.ssy.lingxi.system.service.RuleConfigurationService;
import io.swagger.annotations.Api;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.List;

/**
 * @menu 规则配置-平台规则配置
 * @author wrc
 * @date 2020/7/20
 */
@Api(tags = "规则配置平台规则配置")
@RestController
public class RuleConfigurationController {
    @Resource
    RuleConfigurationService ruleConfigurationService;

    /**
     * 查询平台规则配置
     * @return 查询结果
     */
    @RequestMapping(value = "/rule/configuration/list", method = RequestMethod.GET)
    public Wrapper<List<RuleConfigurationListResponse>> ruleConfigurationList( ) {
        return ruleConfigurationService.ruleConfigurationList();
    }

    /**
     * 修改平台规则配置状态
     * @param request 接口参数
     * @return 修改结果
     */
    @RequestMapping(value = "/rule/configuration/update", method = RequestMethod.POST)
    public Wrapper<Void> ruleConfigurationUpdate(@RequestBody  RuleConfigurationRequest request){
        return ruleConfigurationService.ruleConfigurationUpdate(request);
    }

    /**
     * 查询订单类型
     * @return 查询结果
     */
    @RequestMapping(value = "/rule/getOrderType", method = RequestMethod.GET)
    public Wrapper<List<RuleVO>> getOrderType() {
        return ruleConfigurationService.getOrderType();
    }

    /**
     * 查询订单模式（下单模式）
     * @return 查询结果
     */
    @RequestMapping(value = "/rule/getOrderMode", method = RequestMethod.GET)
    public Wrapper<List<RuleVO>> getOrderMode() {
        return ruleConfigurationService.getOrderMode();
    }
}
